#pragma once
#include "Transform.h"
#include "DAEFloat3.h"
/**
* This class encapsulates a translation, rotation & scale transform.
* @author Koen Samyn
*/
class TRSTransform: public Transform
{
public:
	/**
	* Creates a new Transform object.
	*/
	TRSTransform(void);
	/**
	* Destroys the transform object.
	*/
	virtual ~TRSTransform(void);
	/**
	* Set the translation for this transform object.
	* @param x the x translation.
	* @param y the y translation.
	* @param z the z translation.
	*/
	void SetTranslation(float x, float y, float z ) { 
		m_Translation.SetValues(x,y,z);
		SetChanged(true);
	}
	/**
	* Set the scale for this transform object.
	* @param scaleX the x scale
	* @param scaleY the y scale
	* @param scaleZ the z scale
	*/
	void SetScale(float scaleX, float scaleY, float scaleZ ) {
		m_Scale.SetValues(scaleX,scaleY,scaleZ);
		SetChanged(true);
	}
	/**
	* Set the rotation for this transform object.
	* @param rotX the rotation around the X axis
	* @param rotY the rotation around the Y axis.
	* @param rotZ the rotation around the Z axis.
	*/
	void SetRotation(float rotX, float rotY, float rotZ ) {
		m_Rotation.SetValues(rotX,rotY,rotZ);
		SetChanged(true);
	}
	
	/**
	* Resets this Transform object
	*/
	void ResetTransformParameters();
	/**
	* Gets the rotation around the X axis.
	* @return a float with the X axis rotation.
	*/
	float GetRotX() const {return m_Rotation.x;}
	/**
	* Gets the rotation around the Y axis.
	* @return a float with the Y axis rotation.
	*/
	float GetRotY() const {return m_Rotation.y;}
	/**
	* Gets the rotation around the Z axis.
	* @return a float with the Z axis rotation.
	*/
	float GetRotZ() const {return m_Rotation.z;}
	/**
	* Gets the rotation around the X axis.
	* @return a float with the X axis rotation.
	*/
	float GetTransX() const {return m_Translation.x;}
	/**
	* Gets the rotation around the Y axis.
	* @return a float with the Y axis rotation.
	*/
	float GetTransY() const {return m_Translation.y;}
	/**
	* Gets the translation along the Z axis.
	* @return a float with the Z axis translation.
	*/
	float GetTransZ() const{return m_Translation.z;}
	/**
	* Returns the translation for this transform.
	* @return the translation object.
	*/
	const DAEFloat3& GetTranslation() const{
		return m_Translation;
	}
	/**
	* Gets the X Scale
	* @return a float with the X scale.
	*/
	float GetScaleX() const {return m_Scale.x;}
	/**
	* Gets the Y Scale
	* @return a float with the Y scale.
	*/
	float GetScaleY() const{return m_Scale.y;}
	/**
	* Gets the Z Scale
	* @return a float with the Z scale.
	*/
	float GetScaleZ() const {return m_Scale.z;}
	/**
	* Recalculates the matrix
	*/
	void RecalculateMatrix() const;

	/**
	* Copies the data from the toCopy matrix to this matrix.
	* @param toCopy the array to copy.
	*/
	TRSTransform(const TRSTransform& toCopy){
		m_Rotation = toCopy.m_Rotation;
		m_Translation = toCopy.m_Translation;
		m_Scale = toCopy.m_Scale;
		toCopy.m_Changed = true;
	}

	/**
	* Assigns an other TRSTransfom  to this TRSTransform. 
	* @param toCopy the TRSTransform object to copy.
	*/
	TRSTransform& operator=( const TRSTransform& toCopy ) {
		m_Rotation = toCopy.m_Rotation;
		m_Translation = toCopy.m_Translation;
		m_Scale = toCopy.m_Scale;
		toCopy.m_Changed = true;
		return *this;
	}
private:
	/**
	* The translation
	*/
	DAEFloat3 m_Translation;
	/**
	* The scale factor
	*/
	DAEFloat3 m_Scale;
	/**
	* The rotation.
	*/
	DAEFloat3 m_Rotation;
	/**
	* Matrix with the scale transformation
	*/
	mutable DAEMatrix m_ScaleMatrix;
	/**
	* Matrix with the x rotation.
	*/ 
	mutable DAEMatrix m_RotationXMatrix;
	/**
	* Matrix with the y rotation.
	*/
	mutable DAEMatrix m_RotationYMatrix;
	/**
	* Matrix with the z rotation.
	*/
	mutable DAEMatrix m_RotationZMatrix;
	/**
	* Matrix with the translation
	*/
	mutable DAEMatrix m_TranslationMatrix;
	
};